#include<iostream>

using std::cout;
using std::endl;
class Com
{
public:
static    Com* getinstance()
    {
    
        _p=new Com();
        cout<<_p<<endl;
    return _p;
    }
    class Auto
    {
    public:
        friend
        class Com;
    private:
        ~Auto()
        {
            if(_p!=nullptr)
            {
            delete _p;
            _p=nullptr;
            cout<<"xigou"<<endl;
            }
        }
    };
private:
    Com()
        :_y(1)
    {
    }
    ~Com()
    {
        cout<<"com xigou"<<endl;
    }
    private:
    int _y;
    static Com* _p;
    static Auto a;
};
Com* Com::_p=nullptr;
Com::Auto Com::a;
int main(void)
{
    Com::getinstance();
}
